﻿using System;

namespace YArchitech.Temp
{
	internal class FlowToSpecification : IComparable
	{
		public static bool FlowEqual(double flow1, double flow2)
		{
			return Utility.IsEqual(flow1, flow2, 0.001);
		}

		public double Flow { get; set; }

		public double DesignVelocity { get; set; }

		public HYDuctSpecification Specification { get; set; }

		public int CompareTo(object obj)
		{
			if (obj == null || !(obj is FlowToSpecification))
			{
				return 1;
			}
			FlowToSpecification flowToSpecification = obj as FlowToSpecification;
			if (FlowToSpecification.FlowEqual(this.Flow, flowToSpecification.Flow))
			{
				return 0;
			}
			if (this.Flow >= flowToSpecification.Flow)
			{
				return 1;
			}
			return -1;
		}
	}
}
